package org.mytestfragment.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(name="OccamServlet", loadOnStartup=1, urlPatterns={"/occam/*"})
public class OccamServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
	public OccamServlet() {
		// TODO Auto-generated constructor stub
	}

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		System.out.println("Hitted Occam Servlet");
		String uri = request.getRequestURI();
		
		System.out.println(String.format("URI..................: %s", uri));
		System.out.println(String.format("ViewOperation Class..: %s", uri.substring(uri.lastIndexOf('/') + 1,uri.lastIndexOf('.'))));
		System.out.println(String.format("Method to Call.......: %s", uri.substring(uri.lastIndexOf('.') + 1)));
	}

}
